package com.data.model.sqlclause.where.basic;

import com.data.model.constant.SqlConstant;
import com.data.model.sqlclause.where.basic.AtomicCondition;
import lombok.Data;

@Data
public abstract class SingleValueAtomicCondition extends AtomicCondition {

    private Object value;

    @Override
    public String toConditionStr() {
        String value = this.value.toString();
        if (this.value instanceof String) {
            value = "'" + value + "'";
        }
        return getKey() + SqlConstant.SPACE + getOperator() + SqlConstant.SPACE + value;
    }

    @Override
    public boolean valid() {
        return true;
    }
}
